﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZHDJ.Core.Util;
using ZHDJ.Data.Models.Box;

namespace ZHDJ.Data.Initializer
{
    public static class MenuInit
    {
        public static List<Menu> GetMenus(AppBoxContext context)
        {
            var menus = new List<Menu>
            {
                new Menu
                {
                    ID = StringHelper.NewID,
                    Name = "系统管理",
                    SortIndex = 1,
                    Remark = "顶级菜单",
                    Children = new List<Menu>
                    {
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "用户管理",
                            SortIndex = 10,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/user.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreUserView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "职称管理",
                            SortIndex = 20,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/title.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreTitleView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "职称用户管理",
                            SortIndex = 30,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/title_user.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreTitleUserView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "部门管理",
                            SortIndex = 40,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/dept.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreDeptView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "部门用户管理",
                            SortIndex = 50,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/dept_user.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreDeptUserView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "角色管理",
                            SortIndex = 60,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/role.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreRoleView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "角色用户管理",
                            SortIndex = 70,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/role_user.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreRoleUserView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "权限管理",
                            SortIndex = 80,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/power.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CorePowerView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "角色权限管理",
                            SortIndex = 90,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/role_power.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreRolePowerView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "菜单管理",
                            SortIndex = 100,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/menu.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreMenuView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "在线统计",
                            SortIndex = 110,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/online.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreOnlineView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "系统配置",
                            SortIndex = 120,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/config.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png",
                            ViewPower = context.Powers.Where(p => p.Name == "CoreConfigView").FirstOrDefault<Power>()
                        },
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "用户设置",
                            SortIndex = 130,
                            Remark = "二级菜单",
                            NavigateUrl = "~/app/box/admin/profile.aspx",
                            ImageUrl = "~/Content/icon/tag_blue.png"
                        }
                    }
                },
                new Menu
                {
                    ID = StringHelper.NewID,
                    Name = "站务管理",
                    SortIndex = 2,
                    Remark = "顶级菜单",
                    Children = new List<Menu>
                    {
                        new Menu
                        {
                            ID = StringHelper.NewID,
                            Name = "网上学院",
                            SortIndex = 10,
                            Remark = "二级菜单",
                            Children = new List<Menu>
                            {
                                new Menu
                                {
                                    ID = StringHelper.NewID,
                                    Name = "专题管理",
                                    SortIndex = 10,
                                    Remark = "三级菜单",
                                    NavigateUrl = "~/App/SysManage/Module/Edu/PartyEduSpecialList.aspx",
                                    ImageUrl = "~/Content/icon/tag_blue.png",
                                    ViewPower =
                                        context.Powers.Where(p => p.Name == "PartyEduSpecialView")
                                            .FirstOrDefault<Power>()
                                },
                                new Menu
                                {
                                    ID = StringHelper.NewID,
                                    Name = "题目管理",
                                    SortIndex = 20,
                                    Remark = "三级菜单",
                                    NavigateUrl = "~/App/SysManage/Module/Edu/PartyEduSubjectList.aspx",
                                    ImageUrl = "~/Content/icon/tag_blue.png",
                                    ViewPower =
                                        context.Powers.Where(p => p.Name == "PartyEduSubjectView")
                                            .FirstOrDefault<Power>()
                                }
                            }

                        }
                    }
                }

            };

            return menus;
        }
    }
}
